<!DOCTYPE html>
<html class="ui-page-login">
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title>找回密码</title>
		<link href="css/mui.min.css" rel="stylesheet" />
		<link href="css/style.css" rel="stylesheet" />
		<style>
			.code{
				color:#757575;
			}
		</style>
	</head>

	<body>
		<header class="mui-bar mui-bar-nav">
			<span class="mui-action-back mui-icon mui-icon-arrowleft"></span>
		    <h1 class="mui-title">修改资金密码</h1>
		</header>
		<div class="mui-content">
			<form class="mui-input-group">
				<div class="mui-input-row first">
					<input id='yuanpwsd' type="password" class="mui-input-clear mui-input" placeholder="请输入原密码">
				</div>
				<div class="mui-input-row">
					<input id='password' type="password" class="mui-input-clear mui-input" placeholder="请输入新密码">
				</div>
				<div class="mui-input-row">
					<input id='repwd' type="password" class="mui-input-clear mui-input" placeholder="请再次输入新密码">
				</div>
			</form>
			<div class="mui-content-padded">
				<button id='regg' class="mui-btn mui-btn-block mui-btn-primary reg">提交</button>
			</div>
		</div>
		<script src="js/mui.min.js"></script>
		<script src="https://cdn.bootcss.com/blueimp-md5/2.10.0/js/md5.js"></script>
		<script src='libs/easymob-webim-sdk/jquery-1.11.1.js'></script>
		<script src='js/mstock.js'></script>
		<script src="js/app.js"></script>
		<script src="js/configs.js"></script>
		<script>
			mui.init();
			var password_reg = /^[a-zA-Z\d+]{6,20}$/;
			document.getElementById("regg").addEventListener('tap',function(){
           		var bpws = document.getElementById('yuanpwsd').value; 
			    var pws = document.getElementById('password').value; 
			    var repws = document.getElementById('repwd').value; 
			    if(!bpws){
			    	mui.toast('请输入原密码');return false;
			    }else if(!pws||!password_reg.test(pws)){
			    	mui.toast('请输入正确的新密码');return false;
			    }else if(repws != pws){
			    	mui.toast('两次密码输入不一致，请重新输入');return false;
			    }else{
			    	var _data = {
                    	account:account,
                    	newPswd:md5(pws),
                        pswd:md5(bpws)
                    };
		    		jQuery.ajax({
			    		type:'post',
			    		url:server.stockMoney,
			    		data:_data,
			    		dataType:'json',
			    		beforeSend:function(){
			    			maskShowEvent();
			    		},
			    		success:function(data){
	                        //处理成功返回的数据
	                        console.log(data);
	                        maskHideEvent();
	                        if(data.code==0){
	                        	mui.toast(data.msg);
	                        	setTimeout(mui.back(),1000);
	                        }else{
	                        	mui.toast(data.msg);
	        					return false;  
	                        }
	                    },
	                    error:function(){
	                    	maskHideEvent();
							mui.toast('密码修改失败，请重！'); 
            				return;
	                    }
			    	})
			    }
			})
		</script>
	</body>

</html>